﻿using System;
using System.Linq;
using System.Windows.Data;

namespace SoftSource.Timecard.Entry.Converters
{
    public class RoleToBoolConverter : IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var returnValue = true;

            if (parameter != null)
                returnValue = false;

            if (!WebContext.Current.User.Roles.Contains("Administrator"))
            {
                return !returnValue;
            }
            else
            {
                return returnValue;
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
